//
//  YRJDiscountZoneForAllTableViewCell.m
//  YanRenjie
//
//  Created by dllo on 15/10/30.
//  Copyright (c) 2015年 yanrenjie. All rights reserved.
//

#import "YRJDiscountZoneForAllTableViewCell.h"
#define SWIDTH ([UIScreen mainScreen].bounds.size.width)
#define SHEIGH ([UIScreen mainScreen].bounds.size.height)
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation YRJDiscountZoneForAllTableViewCell
- (void)dealloc {
    [_picImageView release];
    [_titleLabel release];
    [_departureTimeLabel release];
    [_priceLabel release];
    [_lastminute_desLabel release];
    
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.picImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.picImageView];
    [_picImageView release];
    
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.titleLabel];
    [_titleLabel release];
    self.titleLabel.numberOfLines =  2;
    self.titleLabel.font = [UIFont systemFontOfSize:14 * (SHEIGH / 667)];
    
    self.departureTimeLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.departureTimeLabel];
    [_departureTimeLabel release];
    self.departureTimeLabel.font = [UIFont systemFontOfSize:10 * (SHEIGH / 667)];
    self.departureTimeLabel.numberOfLines = 2;
    
    self.priceLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.priceLabel];
    [_priceLabel release];
    self.priceLabel.font = [UIFont systemFontOfSize:10 * (SHEIGH / 667)];
    self.priceLabel.textColor = [UIColor redColor];
    
    self.lastminute_desLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.lastminute_desLabel];
    [_lastminute_desLabel release];
    self.lastminute_desLabel.font = [UIFont systemFontOfSize:10 * (SHEIGH / 667)];
    self.lastminute_desLabel.textColor = [UIColor redColor];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    self.picImageView.frame = CGRectMake(0, 0, WIDTH / 3, HEIGHT);
    self.titleLabel.frame = CGRectMake(WIDTH / 3, 0, WIDTH / 3 * 2, HEIGHT / 2);
    self.departureTimeLabel.frame = CGRectMake(WIDTH / 3, HEIGHT / 2, WIDTH / 3 * 2, HEIGHT / 4);
    self.priceLabel.frame = CGRectMake(WIDTH / 3, HEIGHT / 4 * 3, WIDTH / 3, HEIGHT / 4);
    self.lastminute_desLabel.frame = CGRectMake(WIDTH / 5 * 4, HEIGHT / 4 * 3, WIDTH / 5, HEIGHT / 4);
    NSLog(@"%f", WIDTH);
    NSLog(@"%f", HEIGHT);
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
